<!DOCTYPE html><html><head><title>Ext.chart.Legend | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
<style type="text/css">.head-band { display: none; }
.header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
.doc-tab .members .member a.more { background-color: #efefef; }
</style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
</head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
<a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">

    req = {
        liveURL: '.',
        standAloneMode: true,
        origDocClass: 'Ext.chart.Legend',
        docClass: 'Ext.chart.Legend',
        docReq: 'Ext.chart.Legend',
        version: '4.0',
        baseURL: '.',
        baseDocURL: '.',
        baseProdURL: '.'
    };

    clsInfo = {};



</script>

<script type="text/javascript" src="../search.js"></script>
<!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
<script type="text/javascript" src="../class_tree.js"></script>
<script type="text/javascript" src="../class_doc.js"></script>
<script type="text/javascript">
    req.source = 'Legend.html#Ext-chart.Legend';
    clsInfo = {"methods":["Legend"],"cfgs":["boxFill","boxStroke","boxStrokeWidth","boxZIndex","itemSpacing","labelFont","padding","position","visible","x","y"],"properties":["isVertical"],"events":[],"subclasses":[]};
    Ext.onReady(function() {
        Ext.create('Docs.classPanel');
    });
</script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/Legend.html#Ext-chart.Legend" target="_blank">Ext.chart.Legend</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><p>Defines a legend for a chart's series.
The 'chart' member must be set prior to rendering.
The legend class displays a list of legend items each of them related with a
series being rendered. In order to render the legend item of the proper series
the series configuration object must have <code>showInSeries</code> set to true.</p>

<p>The legend configuration object accepts a <code>position</code> as parameter.
The <code>position</code> parameter can be <code>left</code>, <code>right</code>
<code>top</code> or <code>bottom</code>. For example:</p>

<pre class="prettyprint"><code>legend: {
    position: 'right'
},
</code></pre>

<p>Full example:</p>

<pre class="prettyprint"><code>    var store = Ext.create('Ext.data.JsonStore', {
        fields: ['name', 'data1', 'data2', 'data3', 'data4', 'data5'],
        data: [
            {'name':'metric one', 'data1':10, 'data2':12, 'data3':14, 'data4':8, 'data5':13},
            {'name':'metric two', 'data1':7, 'data2':8, 'data3':16, 'data4':10, 'data5':3},
            {'name':'metric three', 'data1':5, 'data2':2, 'data3':14, 'data4':12, 'data5':7},
            {'name':'metric four', 'data1':2, 'data2':14, 'data3':6, 'data4':1, 'data5':23},
            {'name':'metric five', 'data1':27, 'data2':38, 'data3':36, 'data4':13, 'data5':33}                                                
        ]
    });
    
    Ext.create('Ext.chart.Chart', {
        renderTo: Ext.getBody(),
        width: 500,
        height: 300,
        animate: true,
        store: store,
        shadow: true,
        theme: 'Category1',
        legend: {
            position: 'top'
        },
         axes: [{
                type: 'Numeric',
                grid: true,
                position: 'left',
                fields: ['data1', 'data2', 'data3', 'data4', 'data5'],
                title: 'Sample Values',
                grid: {
                    odd: {
                        opacity: 1,
                        fill: '#ddd',
                        stroke: '#bbb',
                        'stroke-width': 1
                    }
                },
                minimum: 0,
                adjustMinimumByMajorUnit: 0
            }, {
                type: 'Category',
                position: 'bottom',
                fields: ['name'],
                title: 'Sample Metrics',
                grid: true,
                label: {
                    rotate: {
                        degrees: 315
                    }
                }
        }],
        series: [{
            type: 'area',
            highlight: false,
            axis: 'left',
            xField: 'name',
            yField: ['data1', 'data2', 'data3', 'data4', 'data5'],
            style: {
                opacity: 0.93
            }
        }]
    });    
    </code></pre>

<div class="members"><div class="m-cfgs"><div class="definedBy">Defined By</div><a name="configs"></a><h3 class="cfg p">Config Options</h3><h4 class="cfgGroup">Other Configs</h4><div id="config-boxFill" class="member f ni"><a href="Ext.chart.Legend.html#config-boxFill" rel="config-boxFill" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.chart.Legend.html" class="definedIn docClass">Ext.chart.Legend</a><br/><a href="../source/Legend.html#Ext-chart.Legend-cfg-boxFill" class="viewSource">view source</a></div><a name="boxFill"></a><a name="config-boxFill"></a><a href="Ext.chart.Legend.html#" rel="config-boxFill" class="cls expand">boxFill</a><span> : String</span></div><div class="description"><div class="short"><p>Fill style for the legend box</p>
</div><div class="long"><p>Fill style for the legend box</p>
</div></div></div><div id="config-boxStroke" class="member ni"><a href="Ext.chart.Legend.html#config-boxStroke" rel="config-boxStroke" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.chart.Legend.html" class="definedIn docClass">Ext.chart.Legend</a><br/><a href="../source/Legend.html#Ext-chart.Legend-cfg-boxStroke" class="viewSource">view source</a></div><a name="boxStroke"></a><a name="config-boxStroke"></a><a href="Ext.chart.Legend.html#" rel="config-boxStroke" class="cls expand">boxStroke</a><span> : String</span></div><div class="description"><div class="short"><p>Style of the stroke for the legend box</p>
</div><div class="long"><p>Style of the stroke for the legend box</p>
</div></div></div><div id="config-boxStrokeWidth" class="member ni"><a href="Ext.chart.Legend.html#config-boxStrokeWidth" rel="config-boxStrokeWidth" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.chart.Legend.html" class="definedIn docClass">Ext.chart.Legend</a><br/><a href="../source/Legend.html#Ext-chart.Legend-cfg-boxStrokeWidth" class="viewSource">view source</a></div><a name="boxStrokeWidth"></a><a name="config-boxStrokeWidth"></a><a href="Ext.chart.Legend.html#" rel="config-boxStrokeWidth" class="cls expand">boxStrokeWidth</a><span> : String</span></div><div class="description"><div class="short"><p>Width of the stroke for the legend box</p>
</div><div class="long"><p>Width of the stroke for the legend box</p>
</div></div></div><div id="config-boxZIndex" class="member ni"><a href="Ext.chart.Legend.html#config-boxZIndex" rel="config-boxZIndex" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.chart.Legend.html" class="definedIn docClass">Ext.chart.Legend</a><br/><a href="../source/Legend.html#Ext-chart.Legend-cfg-boxZIndex" class="viewSource">view source</a></div><a name="boxZIndex"></a><a name="config-boxZIndex"></a><a href="Ext.chart.Legend.html#" rel="config-boxZIndex" class="cls expand">boxZIndex</a><span> : Number</span></div><div class="description"><div class="short"><p>Sets the z-index for the legend. Defaults to 100.</p>
</div><div class="long"><p>Sets the z-index for the legend. Defaults to 100.</p>
</div></div></div><div id="config-itemSpacing" class="member ni"><a href="Ext.chart.Legend.html#config-itemSpacing" rel="config-itemSpacing" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.chart.Legend.html" class="definedIn docClass">Ext.chart.Legend</a><br/><a href="../source/Legend.html#Ext-chart.Legend-cfg-itemSpacing" class="viewSource">view source</a></div><a name="itemSpacing"></a><a name="config-itemSpacing"></a><a href="Ext.chart.Legend.html#" rel="config-itemSpacing" class="cls expand">itemSpacing</a><span> : Number</span></div><div class="description"><div class="short"><p>Amount of space between legend items</p>
</div><div class="long"><p>Amount of space between legend items</p>
</div></div></div><div id="config-labelFont" class="member ni"><a href="Ext.chart.Legend.html#config-labelFont" rel="config-labelFont" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.chart.Legend.html" class="definedIn docClass">Ext.chart.Legend</a><br/><a href="../source/Legend.html#Ext-chart.Legend-cfg-labelFont" class="viewSource">view source</a></div><a name="labelFont"></a><a name="config-labelFont"></a><a href="Ext.chart.Legend.html#" rel="config-labelFont" class="cls expand">labelFont</a><span> : String</span></div><div class="description"><div class="short"><p>Font to be used for the legend labels, eg '12px Helvetica'</p>
</div><div class="long"><p>Font to be used for the legend labels, eg '12px Helvetica'</p>
</div></div></div><div id="config-padding" class="member ni"><a href="Ext.chart.Legend.html#config-padding" rel="config-padding" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.chart.Legend.html" class="definedIn docClass">Ext.chart.Legend</a><br/><a href="../source/Legend.html#Ext-chart.Legend-cfg-padding" class="viewSource">view source</a></div><a name="padding"></a><a name="config-padding"></a><a href="Ext.chart.Legend.html#" rel="config-padding" class="cls expand">padding</a><span> : Number</span></div><div class="description"><div class="short"><p>Amount of padding between the legend box's border and its items</p>
</div><div class="long"><p>Amount of padding between the legend box's border and its items</p>
</div></div></div><div id="config-position" class="member ni"><a href="Ext.chart.Legend.html#config-position" rel="config-position" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.chart.Legend.html" class="definedIn docClass">Ext.chart.Legend</a><br/><a href="../source/Legend.html#Ext-chart.Legend-cfg-position" class="viewSource">view source</a></div><a name="position"></a><a name="config-position"></a><a href="Ext.chart.Legend.html#" rel="config-position" class="cls expand">position</a><span> : String</span></div><div class="description"><div class="short">The position of the legend in relation to the chart. One of: "top",
"bottom", "left", "right", or "float". If set to ...</div><div class="long"><p>The position of the legend in relation to the chart. One of: "top",
"bottom", "left", "right", or "float". If set to "float", then the legend
box will be positioned at the point denoted by the x and y parameters.</p>
</div></div></div><div id="config-visible" class="member ni"><a href="Ext.chart.Legend.html#config-visible" rel="config-visible" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.chart.Legend.html" class="definedIn docClass">Ext.chart.Legend</a><br/><a href="../source/Legend.html#Ext-chart.Legend-cfg-visible" class="viewSource">view source</a></div><a name="visible"></a><a name="config-visible"></a><a href="Ext.chart.Legend.html#" rel="config-visible" class="cls expand">visible</a><span> : Boolean</span></div><div class="description"><div class="short"><p>Whether or not the legend should be displayed.</p>
</div><div class="long"><p>Whether or not the legend should be displayed.</p>
</div></div></div><div id="config-x" class="member ni"><a href="Ext.chart.Legend.html#config-x" rel="config-x" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.chart.Legend.html" class="definedIn docClass">Ext.chart.Legend</a><br/><a href="../source/Legend.html#Ext-chart.Legend-cfg-x" class="viewSource">view source</a></div><a name="x"></a><a name="config-x"></a><a href="Ext.chart.Legend.html#" rel="config-x" class="cls expand">x</a><span> : Number</span></div><div class="description"><div class="short"><p>X-position of the legend box. Used directly if position is set to "float", otherwise
it will be calculated dynamically.</p>
</div><div class="long"><p>X-position of the legend box. Used directly if position is set to "float", otherwise
it will be calculated dynamically.</p>
</div></div></div><div id="config-y" class="member ni"><a href="Ext.chart.Legend.html#config-y" rel="config-y" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.chart.Legend.html" class="definedIn docClass">Ext.chart.Legend</a><br/><a href="../source/Legend.html#Ext-chart.Legend-cfg-y" class="viewSource">view source</a></div><a name="y"></a><a name="config-y"></a><a href="Ext.chart.Legend.html#" rel="config-y" class="cls expand">y</a><span> : Number</span></div><div class="description"><div class="short"><p>Y-position of the legend box. Used directly if position is set to "float", otherwise
it will be calculated dynamically.</p>
</div><div class="long"><p>Y-position of the legend box. Used directly if position is set to "float", otherwise
it will be calculated dynamically.</p>
</div></div></div></div><div class="m-properties"><a name="properties"></a><div class="definedBy">Defined By</div><h3 class="prp p">Properties</h3><div id="property-isVertical" class="member f ni"><a href="Ext.chart.Legend.html#property-isVertical" rel="property-isVertical" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.chart.Legend.html" class="definedIn docClass">Ext.chart.Legend</a><br/><a href="../source/Legend.html#Ext-chart.Legend-property-isVertical" class="viewSource">view source</a></div><a name="isVertical"></a><a name="property-isVertical"></a><a href="Ext.chart.Legend.html#" rel="property-isVertical" class="cls expand">isVertical</a><span> : Boolean</span></div><div class="description"><div class="short"><p>Whether the legend box is oriented vertically, i.e. if it is on the left or right side or floating.</p>
</div><div class="long"><p>Whether the legend box is oriented vertically, i.e. if it is on the left or right side or floating.</p>
</div></div></div></div><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-Legend" class="member f ni"><a href="Ext.chart.Legend.html#method-Legend" rel="method-Legend" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.chart.Legend.html" class="definedIn docClass">Ext.chart.Legend</a><br/><a href="../source/Legend.html#Ext-chart.Legend-method-constructor" class="viewSource">view source</a></div><a name="Legend"></a><a name="method-Legend"></a><a href="Ext.chart.Legend.html#" rel="method-Legend" class="cls expand">Legend</a> : void</div><div class="description"><div class="short"><p>&nbsp;</p></div><div class="long">
<h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
</li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>